<extend name="Base/common" />
<block name="body">
	<!--导航引用-->
	<include file="Public/nav" />
	<include file="Public/nav_footer" />
	<section class="ui-container">
		<!--搜索引用-->
		<include file="Public/search" />
	    <div class="ui-row-flex ui-border-tb tc ui-pxui-tab">
		    <div class="ui-col ui-border-r  <if condition='$type eq 0'>selected</if>">
		    	<a href="{:U('allGoods')}" class="ui-tiled ui-flex-pack-center"><span>综合</span></a>
		    </div>
		    <div class="ui-col ui-border-r <if condition='$type eq 1'>selected</if>">
		    	<a href="{:U('allGoods', array('priceSort' => 'desc'))}" class="ui-tiled ui-flex-pack-center">
		    		<span>价格</span><i class="iconfont icon-unfold"></i>
		    	</a>
		    </div>
		    <div class="ui-col ui-border-r <if condition='$type eq 2'>selected</if>">
		    	<a href="{:U('allGoods', array('saleSort' => 'desc'))}" class="ui-tiled ui-flex-pack-center">
		    		<span>销量</span>
		    		<i class="iconfont icon-unfold"></i>
		    	</a>
		    </div>
		    <div class="ui-col ui-border-r <if condition='$type eq 3'>selected</if>">
		    	<a href="{:U('allGoods', array('newSort' => 'desc'))}" class="ui-tiled ui-flex-pack-center">
		    		<span>最新</span>
		    		<i class="iconfont icon-unfold"></i>
		    	</a>
		   	</div>
		    <div class="ui-col <if condition='$type eq 4'>selected</if>">
		    	<a href="{:U('allGoods', array('zkSort' => 'desc'))}" class="ui-tiled ui-flex-pack-center">
		    		<span>折扣</span>
		    		<i class="iconfont icon-unfold"></i>
		    	</a>
		    </div>
		</div>
		<ul class="ui-justify ui-pxui-goods">
			<volist name="list" id="v">
		        <li>
		        	<a href="{:U('GoodsList/goods_detail', array('id' => $v['id']))}">
		        		<div class="ui-goods-img-wrap">
		        			<img class="ui-goods-img" src="{$v.picture||get_cover='path'}"/>
		        			<img class="ui-goods-img-size" src="http://placeholder.qiniudn.com/640x300"/>
		        		</div>
		        		<div class="ui-goods-txt">
		        			<p class="name ui-nowrap-multi">{$v.name|msubstr=###,0,12}</p>
				        	<div class="price">
				        		<span>￥{$v.price}/{$v.unit_id|getUnitName=###}</span>
				        		<small class="ui-txt-info">专柜价:</small><del>￥{$v.shop_price}</del>
				        	</div>
		        		</div>  
			        	
			        	<i class="ui-badge-wrap">
		        			<span>立奖<br>{$v.zhekou|count_zhekou=###}%</span>
		        			<i class="ui-badge-tag"></i>
		        		</i>
		        	</a>
		        </li>
	        </volist>
	    </ul>
	    <div class="ui-up"><a href="#"><i class="iconfont icon-fold"></i></a></div>
	    <a href="javascript::" class="ui-more-btn moreData">加载更多</a>
	    <!--版权引用-->
	    <include file="Public/m_footer" />
	</section>
</block>
<block name="script">
	<script type="text/javascript">
		var page = 10;
		var el = '';
		$('.moreData').click(function(){
			$.ajax({
				url: document.URL,
				type: 'get',
				data: {page: page},
				dataType: 'json',
				beforeSend: function(){
					el = $.loading({content:'加载中...'})
				},
				success: function(r){
					el.loading("hide");
					var html = '';
					if(r.status){
						$.each(r.list, function(i, v){
							html += '<li>'+
							        	'<a href="'+v.url+'">'+
							        		'<div class="ui-goods-img-wrap">'+
							        			'<img class="ui-goods-img" src="'+v.pictureurl+'"/>'+
							        			'<img class="ui-goods-img-size" src="http://placeholder.qiniudn.com/200x200"/>'+
							        		'</div>'+
								        	'<p class="name ui-nowrap-multi">'+v.name+'</p>'+
								        	'<div class="price ui-tiled">'+
								        		'<span>￥'+v.price+'</span>'+
								        		'<small class="ui-txt-info">专柜价:</small><del>￥'+v.shop_price+'</del>'+
								        	'</div>'+
								        	'<i class="ui-badge-wrap">'+
							        			'<span>立奖<br>'+v.account_zhekou+'%</span>'+
							        			'<i class="ui-badge-tag"></i>'+
							        		'</i>'+
							        	'</a>'+
							        '</li>';
							page++;
						});
						if( r.list.length < 10 ){
							// $('.ui-more-btn').html('没有更多数据！').removeClass('moreData');
							$('.ui-more-btn').remove();
						}
						$('.ui-pxui-goods').append(html);
					}
				}
			});
		});
	</script>
</block>
